/**
 * Created with webstrom
 * author:金海宾
 * Date:2017/5/25
 * Time:11:34
 */

import util from '../../common/js/utils';

/**
 * 获取 loading状态
 * @param state
 * @returns {boolean}
 */
export const getLoading = function(state) {
  return state.loading;
};
/**
 * 获取用户信息
 * @param state
 */
export const getUsers = function(state) {
  if (!state.user) {
    util.toLogin();
    return {};
  }
  return state.user;
};

/**
 * 获取用户菜单
 * @param state
 * @returns {menuList|{type, default}|*[]|Array|*}
 */
export const getMenus = function(state) {
  return state.user.systemMenu;
};

/**
 * 获取原始菜单
 * @param state
 * @returns {*}
 */
export const getOriginalMenu = function(state) {
  return state.user.menus;
};
